/**
*排行榜Item 
**/

cc.Class({
    extends: cc.Component,

    properties: {
        lbTop:cc.Label,
        spHeadImg:cc.Sprite,
        txtTopNum:cc.Label,
    },

    setData:function(data,index){
        this.data = data;
        // console.log("endTopItem-setData:"+JSON.stringify(data));
        this.txtTopNum.string = data.h_score;
        let image =wx.createImage();
        var that = this;
        image.onload = function(){
            let texture = new cc.Texture2D();
            texture.initWithElement(image);
            texture.handleLoadedTexture();
            that.spHeadImg.spriteFrame = new cc.SpriteFrame(texture);
        }
        image.src = data.avatarUrl;
        this.lbTop.string = index+1;
    },
});
